package com.timberwood.controller;


import java.util.List;

import com.opensymphony.xwork2.ActionSupport;
import com.timberwood.model.dao.UserDAO;
import com.timberwood.model.entity.Users;

public class UserAction extends ActionSupport {
	private static final long serialVersionUID = 1L;

	
	private Users user;
	
	private UserDAO  userDAO;
	
	public UserAction() {
		userDAO=new UserDAO();
	}
	
	
	public Users getUser() {
		return user;
	}
	public void setUser(Users user) {
		this.user = user;
	}

	public String checkLoginAdmin(){
		int status=userDAO.checkLoginAdmin(user.getUsername(), user.getPassword());
		if(status>0){
			return SUCCESS;
		}else{
			return ERROR;
		}
	}
	
	
	private List<Users> listUser;

	public List<Users> getListUser() {
		return listUser;
	}
	public String userActivity() {
		listUser=userDAO.sleUserActivity();
		return SUCCESS;
	}
	public String userBlock() {
		listUser=userDAO.sleUserBlock();
		return SUCCESS;
	}
	
	
	
}
